package models

import "context"

//引导对话
type GuardWord struct {
	Question string `bson:"question"`
	Answer string `bson:"answer"`
}

var (
	guardWordList = make(Arr)
)

func GuardWordAdd(question, answer string)  {
	guardWordList[question] = answer
	return

	//todo 使用mongodb保存
	_, err := MongoDBDefault.Collection("guard_ward").InsertOne(context.TODO(), &GuardWord{
		Question: question,
		Answer:   answer,
	})

	if err != nil {
		panic(err)
	}
}

func GuardWordFetch(question string) string {
	tmp := guardWordList[question]
	if tmp == nil {
		return ""
	}
	return tmp.(string)

	//todo 使用mongodb保存
	MongoDBDefault.Collection("guard_ward").FindOne(context.TODO(), Arr{})

	return ""
}